<?php

namespace App\model\panyuan;

use App\model\Workshop;
use Illuminate\Database\Eloquent\Model;

/**
 * App\model\panyuan\MyApply
 *
 * @property int $id
 * @property string|null $code
 * @property int|null $status
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property string|null $type
 * @property int|null $user_id
 * @property int|null $workshop_id
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereWorkshopId($value)
 * @property-read \App\model\Workshop|null $workshop
 * @property int|null $last_status
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\MyApply whereLastStatus($value)
 */
class MyApply extends Model
{
    protected $table="my_apply";
    const  SHENHE=1;
    const  SHENHE_PULISHED=2;
    const  SHENHE_REFUSE=3;
    const  SHENHE_CANCEL=4;
    const  SHENHE_YEWU_PULISHED=5;
    const  SHENHE_YEWU_REFUSE=6;
    public static $shenheMap=[
        1=>'审核中',
        2=>'通过',
        3=>'未通过',
        4=>'已取消',
    ];
    public static $statusMap=[
        1=>'审核中',
        2=>'通过',
        3=>'未通过',
        4=>'已取消',
        5=>'业主信息已审核',
        6=>'业主信息未通过',
    ];

    const Created_panyuan=0;
    const Updated_panyuan=1;
    const View_panyuan=2;
    public static $typeMap=[
        self::Created_panyuan=>'创建盘源审核',
        self::Updated_panyuan=>'修改盘源审核',
        self::View_panyuan=>'申请查看业主信息'
    ];
    public function workshop(){
        return $this->belongsTo(Workshop::class,'workshop_id');
    }
}
